# Maintainer: Kyle Keen <keenerd@gmail.com>
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: damir <damir@archlinux.org>
# Contributor: Ben <contrasutra@myrealbox.com>

pkgname=elinks
pkgver=0.16.1
pkgrel=1
pkgdesc="Advanced, feature-rich text mode web browser"
arch=("loong64" "x86_64")
url="http://elinks.or.cz"
license=('GPL')
depends=('bzip2' 'expat>=2.0' 'gpm>=1.20.4' 'openssl' 'lua' 'libidn'
	 'gc' 'tre' 'zlib')
source=("elinks-$pkgver.tgz::https://github.com/rkd77/elinks/archive/v$pkgver.tar.gz")
sha256sums=('f23f25cc036c36d63a39cb9afa44619b8ca022c0a485cdb1ffe16912b42580e1')

# todo: make it work with a modern 'js' package
# (upstream has no interest in writing that)

build() {
  cd elinks-$pkgver
  sed -i 's/Terminal=1/Terminal=true/' "contrib/debian/$pkgname.desktop"
  [ -x configure ] || sh autogen.sh
  ./configure --prefix=/usr --mandir=/usr/share/man \
              --sysconfdir=/etc \
              --disable-smb --without-x --enable-cgi \
              --enable-leds --enable-256-colors --enable-html-highlight \
              --with-zlib --with-luapkg=lua54
  make -j1
}

package() {
  cd elinks-$pkgver
  make DESTDIR="$pkgdir" install
  rm -f "$pkgdir/usr/share/locale/locale.alias"

  install -D -m644 "contrib/debian/$pkgname.desktop" \
    "$pkgdir/usr/share/applications/$pkgname.desktop"
}
